
<?php
/**
 * @package    Joomla.Tutorials
 * @subpackage Components
 * @link http://dev.joomla.org/component/option,com_jd-wiki/Itemid,31/id,tutorials:modules/
 * @license    GNU/GPL
 */

// no direct access

defined( '_JEXEC' ) or die( 'Restricted access' );

jimport('joomla.application.component.controller');

/**
 * Hello World Component Controller
 *
 * @package    Joomla.Tutorials
 * @subpackage Components
 */
class eventlistControllerEditcatcss extends JController
{
/**/
	function __construct()
	{
		//var_dump('controller');
		//$this->_name = 'config';
		parent::__construct();
		
		// Register Extra tasks
	//	$this->registerTask( 'add'  , 	'edit' );
		//$this->edit();
		//var_dump('controller,construct');
	//	$data = JRequest::get( 'post' );
		//var_dump($data);
	}

	function edit()
	{
		//var_dump('control_edit');
	//	var_dump($this->_name);
		//var_dump(JRequest::getVar( 'view'));
		JRequest::setVar( 'view', 'editcatcss' );
		JRequest::setVar( 'layout', 'form'  );
		//JRequest::setVar( 'model', 'config'  );
		//JRequest::setVar('hidemainmenu', 1);
	//	var_dump($this);
		$document = &JFactory::getDocument();
		$vType		= $document->getType();
		$view =& $this->getView('editcatcss',$vType);
		$view->setLayout('form');
		$model =& $this->getModel('editcatcss');
		//$model =& $this->getModel();
		//	var_dump($this);
		$model->getData();
		$view->setModel($model);
		//$view->assignRef('cat_data', $model->_com_data);
		//$view->assignRef('cat_params', $model->cat_params);
		$view->display();
		//parent::display();

		// Checkin the weblink
		//$model = $this->getModel('calendar');
		//$model->checkout();
	}


	function save()
	{
	global $mainframe;
	//var_dump('to model for store');
	$model = $this->getModel('editcatcss');
	
	//var_dump('to model for store check');
    if ($model->store()) {
		//var_dump('to model for store');
		//$post = JRequest::get('POST');
		//var_dump($post);
       $msg = JText::_( 'Event Saved!' );
		// uncomment to create serialized db in xml (for export)
		//$this->update_xml();
    } else {
		//var_dump('not to model for store');
        $msg = JText::_( 'Error Saving Event' );
    }

    // Check the table in so it can be edited.... we are done with it anyway
    $link = 'index.php?option=com_eventlist';
    $this->setRedirect($link, $msg);
	}
	
	function apply()
	{
	global $mainframe;
	//var_dump('to model for store');
	$model = $this->getModel('editcatcss');
	//var_dump($this);
	
	// use bookstore api to get isbn bk cover path
	// if requested in params
//	$params =& JRequest::getVar('params');
//	$config = &JFactory::getConfig();
//	$api_on = $config->getValue('config.bookstore_api', NULL);

	//}	
	
	//var_dump('to model for store check');
    if ($model->store()) {
		//var_dump('to model for store');
		//$post = JRequest::get('POST');
		//var_dump($post);
    	$msg = JText::_( 'Event Saved!' );
		// uncomment to create serialized db in xml (for export)
		//$this->update_xml();
    } else {
		//var_dump('not to model for store');
        $msg = JText::_( 'Error Saving Event' );
    }
	//var_dump($model->update);
	$this->edit();
    // Check the table in so it can be edited.... we are done with it anyway
   // $link = 'index.php?option=com_calendar';
//    $this->setRedirect($link, $msg);
	}
/*
*/
	
function cancel()
{
    $msg = JText::_( 'Operation Cancelled' );
    $this->setRedirect( 'index.php?option=com_eventlist', $msg );
}

    
    function display()
    {
		//$data = JRequest::get( 'post' );
		//var_dump($data);
		//var_dump('controller_display');
		$this->edit();
       //parent::display();
    }

}

?>
